package leetcode.code2086;

import leetcode.IDebug;

public class Solution implements IDebug {

	public int minimumBuckets(String street) {
		char[] cs = street.toCharArray();
		int ans = 0;
		int p = 0;
		int len = cs.length;
		while (p < len) {
			char c = cs[p];
			if (c == 'H') {
				char l = p - 1 < 0 ? 'H' : cs[p - 1];
				char r = p + 1 == len ? 'H' : cs[p + 1];
				if (l == 'H' && r == 'H') {
					return -1;
				} else if (l == '.' && r == '.') {
					ans += 1;
					cs[p + 1] = 'B';
				} else if (l == 'H' && r == '.') {
					ans += 1;
					cs[p + 1] = 'B';
				} else if (l == '.' && r == 'H') {
					ans += 1;
				} else if (l == 'B' && r == 'H') {
//					ans += 1;
//					cs[p + 1] = 'B';
				} else if (l == 'B' && r == '.') {
//					ans += 1;
//					cs[p + 1] = 'B';
				}
			}
			p++;
		}
		return ans;
	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
